/*
 * serialComm_port.h
 *
 *  Created on: Apr 25, 2021
 *      Author: taoyu
 */

#ifndef SERIALCOMM_INC_SERIALCOMM_PORT_H_
#define SERIALCOMM_INC_SERIALCOMM_PORT_H_

#include <stdint.h>
#include "serialComm_cfg.h"

// init
extern void serialComm_pport_init(SERIAL_COMM_CHANNEL channel);

// task
extern void serialComm_pport_task1ms(SERIAL_COMM_CHANNEL channel);

// a byte is received
extern int serialComm_ISR_dataByteReceived(SERIAL_COMM_CHANNEL channel, uint8_t data);

// rx idle is detected
extern int serialComm_ISR_busIdleDetected(SERIAL_COMM_CHANNEL channel);

// a byte is sent
extern int serialComm_ISR_sendBufferEmpty(SERIAL_COMM_CHANNEL channel);

// send data
extern void serialComm_rport_sendData(SERIAL_COMM_CHANNEL channel, uint8_t data);

// start send
extern void serialComm_rport_startSend(SERIAL_COMM_CHANNEL channel);

// stop send
extern void serialComm_rport_stopSend(SERIAL_COMM_CHANNEL channel);

#endif /* SERIALCOMM_INC_SERIALCOMM_PORT_H_ */

